<template>
	<view class="page-container">
		<!-- 页面内容 -->
		<view class="top">
			<view class="houtui">
				＜
			</view>
			<view class="sankuang">
				<text>答题</text>
				<text>背题</text>
				<text>视频</text>
			</view>
			<view class="set">
				设置
			</view>
		</view>
		<view class="center">
			<view class="wenti">
				<image src="../../static/danxuan.png" mode=""></image>
				<text>驾驶这种机动车上路行驶属于什么行为？ <button class="mini-btn" type="primary" size="mini">读题</button></text>
			</view>
			<view class="tupian">
				<image src="../../static/che.png" mode=""></image>
			</view>
			<view class="sixuan" bindtap="onOptionTap">
				<view class="xuanxiang" v-for="(item,index) in options" :key="index" @click="handleSelect(index)">
					<text :class="{ 'selected': selectedIndex === index }">{{item.select}}</text> {{item.txt}}
				</view>
			</view>
		</view>
		<view class="foot">
			<view class="shoucang">
				<text>☆ 收藏</text>
			</view>
			<view class="zhengqueshu">
				<text style="color: deepskyblue;">✔ 1</text>
			</view>
			<view class="cuowushu">
				<text style="color: red;">✘ 0</text>
			</view>
			<view class="dijidao">
				<text style="color: darkgrey;">▓▓ 2/1598</text>
			</view>
		</view>
	</view>
</template>


<script>
	import {
		ref
	} from 'vue';

	export default {
		setup() {
			const options = ref([{
					select: 'A',
					txt: 'a,选项'
				},
				{
					select: 'B',
					txt: 'b选项'
				},
				{
					select: 'C',
					txt: 'c选项'
				},
				{
					select: 'D',
					txt: 'd选项'
				},
			]);

			const selectedIndex = ref(null); // 初始时没有选中项  

			// 点击事件处理器  
			const handleSelect = (index) => {
				selectedIndex.value = index; // 更新选中的索引  
			};

			// 返回响应式数据和方法  
			return {
				options,
				selectedIndex,
				handleSelect,
			};
		},
	};
</script>

<style>
	.page-container {
		padding: 0 20px 0 20px;
		/* 这将设置页面内容与屏幕边缘的距离为20px */
		position: relative;
	}

	.top {
		height: 3rem;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.sankuang {
		box-sizing: border-box;
	}

	.sankuang text {
		border: 0.05rem solid #000;
		padding: 0.2rem 0.8rem;
	}

	.button-sp-area {
		margin: 0 auto;
		width: 60%;
	}

	.mini-btn {
		margin-right: 10rpx;
	}

	.wenti {
		margin-top: 0.5rem;
		font-size: 1.2rem;
	}

	.wenti image {
		width: 1.6rem;
		height: 1rem;
	}

	.tupian image {
		margin-top: 1.5rem;
		width: 100%;
		height: 10rem;
	}

	.sixuan {
		width: 100%;
	}

	.xuanxiang {
		height: 3rem;
		display: flex;
		align-items: center;
	}

	.option {
		border: 0.03rem solid #ccc;
		border-radius: 50%;
		width: 1.5rem;
		height: 1.5rem;
		display: flex;
		justify-content: center;
		align-items: center;
		text-align: center;
		margin-left: 0;
		margin-right: 0;
		margin-top: 1.5rem;
	}


	.selected {
		/* background-color: blue; */
		color: white;
		/* 可选：使选中的文本颜色变为白色 */
		background-color: aqua;
		border-radius: 50%;
		text-align: center;
		box-sizing: border-box;
	}


	.xuanxiang text {
		margin-right: 2rem;
		width: 1.5rem;
		text-align: center;

	}

	.foot {
		width: 100%;
		height: 3rem;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		display: flex;
		justify-content: space-around;
		align-items: center;

	}
</style>